﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyNet.Componets.Core.Pagers
{
    public class PagerQuery
    {
        #region Ctor

        public PagerQuery()
        {
            Init(1, 20, null, null);
        }

        public PagerQuery(int pageIndex, int pageSize)
        {

            Init(pageIndex, pageSize, null, null);
        }

        public PagerQuery(int pageIndex, int pageSize, List<PagerSort> sortList)
        {
            Init(pageIndex, pageSize, sortList, null);
        }

        public PagerQuery(int pageIndex, int pageSize, List<PagerSort> sortList, List<PagerCondition> conditiaonList)
        {
            Init(pageIndex, pageSize, sortList, conditiaonList);
        }

        private void Init(int pageIndex, int pageSize, List<PagerSort> sortList, List<PagerCondition> conditiaonList)
        {
            this.PageIndex = pageIndex;
            this.PageSize = pageSize;
            this.SortList = sortList ?? new List<PagerSort>();
            this.ConditiaonList = conditiaonList ?? new List<PagerCondition>();
        }
        #endregion

        #region Public Properties
        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; }

        /// <summary>
        /// 页面大小
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 查询条件集合
        /// </summary>
        public List<PagerCondition> ConditiaonList { get; set; }

        /// <summary>
        /// 排序集合
        /// </summary>
        public List<PagerSort> SortList { get; set; }


        #endregion

    }
}
